package com.algernoon.rpc.springrpc.rmi.httpinvoker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.algernoon.rpc.springrpc.entity.User;

@RestController
public class HttpInvokerRmiController {

	Logger logger = LoggerFactory.getLogger(HttpInvokerRmiController.class);

	@Autowired
	private IHttpInvokerUserService httpInvokerUserService;

	@GetMapping("/http-invoker/rmi/user/{id}")
	@ResponseBody
	public User findUserById(@PathVariable Integer id) {
		logger.info("[findUserById] request param id is {}.", id);
		return httpInvokerUserService.findUserById(id);
	}

}
